--[[
  module: Game

  This module contains functionality for scripts that only run on server.

  Should be installed in `game` array of `project.json`.

  Availability: Game script::
  Access: Read-Only::
]]


--[[
  method: FindPlayerAt

  Get the <Game.Player> entity at given position.

  Access: Read-Only::

  Parameters:
    position - (*table / <~Virtual Table.vector3D>*) Position to find at.

  Returns:
    (*<Game.Player> / nil*) The player entity instance (nil = Not found).
]]
function Game.FindPlayerAt (position)


--[[
  func: GetTime

  Get the game time.

  Access: Read-Only::

  Notes:
    - The returned value is same as <Game.Rule.OnUpdate>'s `time` argument.

  Returns:
    (*number*) The game time.

  See Also:
    - <UI.GetTime>
    - <Game.Rule.OnUpdate>
]]
function Game.GetTime ()


--[[
  method: SetTrigger

  Turn on/off all Device Control Script blocks with given trigger name.

  Access: Read-Only::

  Parameters:
    name  - (*string*) The trigger name.
    value - (*bool*) Input value (true = Turn on)(false = Turn off).
]]
function Game.SetTrigger (name, value)


--[[
  method: GetEntity

  Get the entity at given entity index.

  Access: Read-Only::

  Parameters:
    index - (*int*) The entity index.

  Returns:
    (*<Game.Entity> / nil*) The entity instance (nil = Not found).
]]
function Game.GetEntity (index)


--[[
  method: RandomInt

  Get the random integer value.

  Access: Read-Only::

  Notes:
    - Alternative to <`math.random`: https://www.lua.org/manual/5.4/manual.html#pdf-math.random>.

  Parameters:
    min - (*int*) Start position.
    max - (*int*) End position.

  Returns:
    (*int*) The generated value.
]]
function Game.RandomInt (min, max)


--[[
  method: RandomFloat

  Get the random number/float value.

  Access: Read-Only::

  Notes:
    - Alternative to <`math.random`: https://www.lua.org/manual/5.4/manual.html#pdf-math.random>.

  Parameters:
    min - (*number*) Start position.
    max - (*number*) End position.

  Returns:
    (*number*) The generated value.
]]
function Game.RandomFloat (min, max)


--[[
  method: GetTriggerEntity

  Get the caller entity of the currently triggered Function Caller block.

  Access: Read-Only::

  Warnings:
    - Only accessible inside of a global function called by a Function Caller block.

  Returns:
    (*<Game.Entity> / nil*) The caller entity (nil = No caller entity).
]]
function Game.GetTriggerEntity ()


--[[
  method: GetScriptCaller

  Get the currently triggered Function Caller block.

  Access: Read-Only::

  Warnings:
    - Only accessible inside of a global function called by a Function Caller block.

  Returns:
    (*<Game.EntityBlock> / nil*) The called entity (nil = Not a Function Caller block).
]]
function Game.GetScriptCaller ()


--[[
  method: KillAllMonsters

  Kill all monsters on the next <Game.Rule.OnUpdate> call.

  Access: Read-Only::
]]
function Game.KillAllMonsters ()


--[[
  enum: TEAM

  --- Lua
  Game.TEAM
  ---

  List of team.

  Data Type: table::
  Access: Read-Only::

  UNASSIGNED - (*int*) Unassigned.
  TR         - (*int*) Terrorist.
  CT         - (*int*) Counter-Terrorist.
  SPECTATOR  - (*int*) Spectator.
]]


--[[
  enum: MODEL

  --- Lua
  Game.MODEL
  ---

  List of player models.

  Data Type: table::
  Access: Read-Only::

  DEFAULT                 - (*int*) (Don't Override) Use player's selected model.
  SEAL                    - (*int*) (Counter-Terrorist) SEAL Team 6.
  GSG9                    - (*int*) (Counter-Terrorist) GSG-9.
  GIGN                    - (*int*) (Counter-Terrorist) GIGN.
  SAS                     - (*int*) (Counter-Terrorist) SAS.
  SPETSNAZ                - (*int*) (Counter-Terrorist) SPETSNAZ.
  GUERILLA                - (*int*) (Terrorist) Guerilla Warfare.
  PHOENIX                 - (*int*) (Terrorist) Phoenix Connexion.
  ELITE                   - (*int*) (Terrorist) Elite Crew.
  ARCTIC                  - (*int*) (Terrorist) Arctic Avengers.
  MILITIA                 - (*int*) (Terrorist) Midwest Militia.
  HERO                    - (*int*) (Human) Hero.
  HEROINE                 - (*int*) (Human) Heroine.
  NORMAL_ZOMBIE           - (*int*) (Zombie) (Common) Normal.
  LIGHT_ZOMBIE            - (*int*) (Zombie) (Common) Light.
  HEAVY_ZOMBIE            - (*int*) (Zombie) (Common) Heavy.
  PHYCHO_ZOMBIE           - (*int*) (Zombie) (Common) Psycho.
  VOODOO_ZOMBIE           - (*int*) (Zombie) (Common) Voodoo.
  DEIMOS_ZOMBIE           - (*int*) (Zombie) (Common) Deimos.
  GANYMEDE_ZOMBIE         - (*int*) (Zombie) (Common) Ganymede/Metus.
  STAMPER_ZOMBIE          - (*int*) (Zombie) (Common) Stamper.
  BANSHEE_ZOMBIE          - (*int*) (Zombie) (Common) Banshee.
  VENOMGUARD_ZOMBIE       - (*int*) (Zombie) (Common) Venom Guard.
  STINGFINGER_ZOMBIE      - (*int*) (Zombie) (Common) Sting Finger/Venom Sting.
  METATRON_ZOMBIE         - (*int*) (Zombie) (Common) Metatron/Metatronic.
  LILITH_ZOMBIE           - (*int*) (Zombie) (Common) Lilith/Warp.
  CHASER_ZOMBIE           - (*int*) (Zombie) (Common) Chaser.
  BLOTTER_ZOMBIE          - (*int*) (Zombie) (Common) Blotter/Bloater.
  RUSTYWING_ZOMBIE        - (*int*) (Zombie) (Common) Rusty Wing.
  AKSHA_ZOMBIE            - (*int*) (Zombie) (Common) Aksha.
  NORMAL_ZOMBIE_HOST      - (*int*) (Zombie) (Evolved) Normal.
  LIGHT_ZOMBIE_HOST       - (*int*) (Zombie) (Evolved) Light.
  HEAVY_ZOMBIE_HOST       - (*int*) (Zombie) (Evolved) Heavy.
  PHYCHO_ZOMBIE_HOST      - (*int*) (Zombie) (Evolved) Psycho.
  VOODOO_ZOMBIE_HOST      - (*int*) (Zombie) (Evolved) Voodoo.
  DEIMOS_ZOMBIE_HOST      - (*int*) (Zombie) (Evolved) Deimos.
  GANYMEDE_ZOMBIE_HOST    - (*int*) (Zombie) (Evolved) Ganymede/Metus.
  STAMPER_ZOMBIE_HOST     - (*int*) (Zombie) (Evolved) Stamper.
  BANSHEE_ZOMBIE_HOST     - (*int*) (Zombie) (Evolved) Banshee.
  VENOMGUARD_ZOMBIE_HOST  - (*int*) (Zombie) (Evolved) Venom Guard.
  STINGFINGER_ZOMBIE_HOST - (*int*) (Zombie) (Evolved) Sting Finger/Venom Sting.
  METATRON_ZOMBIE_HOST    - (*int*) (Zombie) (Evolved) Metatron/Metatronic.
  LILITH_ZOMBIE_HOST      - (*int*) (Zombie) (Evolved) Lilith/Warp.
  CHASER_ZOMBIE_HOST      - (*int*) (Zombie) (Evolved) Chaser.
  BLOTTER_ZOMBIE_HOST     - (*int*) (Zombie) (Evolved) Blotter/Bloater.
  RUSTYWING_ZOMBIE_HOST   - (*int*) (Zombie) (Evolved) Rusty Wing.
  AKSHA_ZOMBIE_HOST       - (*int*) (Zombie) (Evolved) Aksha.
]]


--[[
  enum: WEAPONTYPE

  --- Lua
  Game.WEAPONTYPE
  ---

  List of weapon categories.

  Data Type: table::
  Access: Read-Only::

  NONE          - (*int*) Undefined.
  KNIFE         - (*int*) Knife/Melee.
  PISTOL        - (*int*) Pistol.
  GRENADE       - (*int*) Grenade.
  SUBMACHINEGUN - (*int*) Sub-machine gun.
  SHOTGUN       - (*int*) Shotgun.
  MACHINEGUN    - (*int*) Machine gun.
  RIFLE         - (*int*) Assault Rifle.
  SNIPERRIFLE   - (*int*) Sniper Rifle.
  EQUIPMENT     - (*int*) Equipment/Miscellaneous.
]]


--[[
  enum: HITBOX

  --- Lua
  Game.HITBOX
  ---

  List of entity hitboxes.

  Data Type: table::
  Access: Read-Only::

  HEAD     - (*int*) Head.
  CHEST    - (*int*) Chest.
  STOMACH  - (*int*) Stomatch/Gut.
  LEFTARM  - (*int*) Left Arm.
  RIGHTARM - (*int*) Right Arm.
  LEFTLEG  - (*int*) Left Leg.
  RIGHTLEG - (*int*) Right Leg.
]]


--[[
  enum: ENTITYTYPE

  --- Lua
  Game.ENTITYTYPE
  ---

  List of entity types.

  Data Type: table::
  Access: Read-Only::

  ENTITY  - (*int*) Generic entity.
  MONSTER - (*int*) Monster entity.
  PLAYER  - (*int*) Player entity.
]]


--[[
  enum: MONSTERTYPE

  --- Lua
  Game.MONSTERTYPE
  ---

  List of monster types.

  Data Type: table::
  Access: Read-Only::

  NONE        - (*int*) Undefined.
  NORMAL0     - (*int*) Walker Zombie (Level 0).
  NORMAL1     - (*int*) Walker Zombie (Level 1).
  NORMAL2     - (*int*) Walker Zombie (Level 2).
  NORMAL3     - (*int*) Walker Zombie (Level 3).
  NORMAL4     - (*int*) Walker Zombie (Level 4).
  NORMAL5     - (*int*) Walker Zombie (Level 5).
  NORMAL6     - (*int*) Walker Zombie (Level 6).
  RUNNER0     - (*int*) Runner Zombie (Level 0).
  RUNNER1     - (*int*) Runner Zombie (Level 1).
  RUNNER2     - (*int*) Runner Zombie (Level 2).
  RUNNER3     - (*int*) Runner Zombie (Level 3).
  RUNNER4     - (*int*) Runner Zombie (Level 4).
  RUNNER5     - (*int*) Runner Zombie (Level 5).
  RUNNER6     - (*int*) Runner Zombie (Level 6).
  HEAVY1      - (*int*) Armored Walker Zombie (Level 1) (Riot Police).
  HEAVY2      - (*int*) Armored Walker Zombie (Level 2) (Riot Police).
  GHOST       - (*int*) Cloth Ghost (Halloween Theme Pack).
  PUMPKIN     - (*int*) Pumpkin-headed Scarecrow (Halloween Theme Pack).
  PUMPKINHEAD - (*int*) Pumpkin Head (Halloween Theme Pack).
  A101AR      - (*int*) A101AR (Assault Rifle).
  A104RL      - (*int*) A104RL (Rocket Launcher).
]]


--[[
  enum: RENDERFX

  --- Lua
  Game.RENDERFX
  ---

  List of entity rendering effects.

  Data Type: table::
  Access: Read-Only::

  NONE       - (*int*) No effect.
  GLOWSHELL  - (*int*) Glowing shell.
]]


--[[
  enum: WEAPONCOLOR

  --- Lua
  Game.WEAPONCOLOR
  ---

  List of weapon exclusiveness colors.

  Data Type: table::
  Access: Read-Only::

  NONE   - (*int*) Default.
  GREEN  - (*int*) Green.
  WHITE  - (*int*) White.
  RED    - (*int*) Red.
  BLUE   - (*int*) Blue.
  YELLOW - (*int*) Yellow.
  ORANGE - (*int*) Orange.
]]


--[[
  enum: THIRDPERSON_FIXED_PLANE

  --- Lua
  Game.THIRDPERSON_FIXED_PLANE
  ---

  List of available raycast setting of mouse pointer when fixed third-person view is enabled.

  Data Type: table::
  Access: Read-Only::

  GROUND - (*int*) Raycasting on XY plane, at player position and surrounding objects.
  XY     - (*int*) Raycasting on XY plane, at player position.
  XZ     - (*int*) Raycasting on XZ plane, at player position.
  YZ     - (*int*) Raycasting on YZ plane, at player position.
]]

